# Contributor: Lauren N. Liberda <lauren@selfisekai.rocks>
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
pkgname=android-apkeep
pkgver=0.15.0
pkgrel=1
pkgdesc="A command-line tool for downloading Android APK files from various sources"
url="https://github.com/EFForg/apkeep"
# ppc64le, riscv64, s390x: ring crate
arch="all !ppc64le !riscv64 !s390x"
license="MIT"
makedepends="
	bzip2-dev
	cargo
	cargo-auditable
	openssl-dev
	zstd-dev
	"
source="https://github.com/EFForg/apkeep/archive/refs/tags/$pkgver/apkeep-$pkgver.tar.gz"
options="!check"	# no tests
builddir="$srcdir/apkeep-$pkgver"


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked

	# Rust target triple.
	local target=$(rustc -vV | sed -n 's/host: //p')

	# Build against system-provided libs
	mkdir -p .cargo
	cat >> .cargo/config.toml <<-EOF
		[target.$target]
		bzip2 = { rustc-link-lib = ["bz2"] }
		zstd = { rustc-link-lib = ["zstd"] }
	EOF
}

build() {
	cargo auditable build --frozen --release
}

package() {
	install -Dm755 target/release/apkeep "$pkgdir"/usr/bin/apkeep
}

sha512sums="
ffc089896a0d223cdbb8534f7e77a86cbc899d3c8200d416f88fdce143e5583403322484b45aa238f27beb5f125f0152d3e6ff678a59f4adba54c4d6d5c6b42a  apkeep-0.15.0.tar.gz
"
